package algo;

import java.util.*;

public class Example {
    public static void main(String[] args) {
        System.out.println(Math.log(4));
//        Math.pow
        long i = Integer.MAX_VALUE + 1l;
        long l = Integer.MAX_VALUE + 1;
//        new ArrayList<Integer>()
        int x = 3;
//        System.arraycopy();
        String str = "Geeks Gor Geeks";
        StringBuilder sb = new StringBuilder();
//        sb.insert(0,(char)(node.val-'a'));
        sb.insert(0,'a');
        sb.append('d');
        sb.deleteCharAt(0);
        System.out.println(sb.toString());
//        sb.append
        System.out.println("".compareTo("ac"));

        // Get the index
        int index = 6;

        // Get the character
        char ch = 'F';

        // Print the original string
        System.out.println("Original String = " + str);

        StringBuilder string = new StringBuilder(str);
        string.setCharAt(index, ch);
        System.out.println("Modified String = " + string.toString());

        int[] a1 = new int[3];
        int[] a2 = Arrays.copyOf(a1, 2);
        int[] a3 = Arrays.copyOf(a1, a1.length);
        double random = Math.random();


//        System.out.println(1 << x);
//        StringBuilder sb = new StringBuilder();
//        sb.length();
//        sb.deleteCharAt(sb.length()-1);
////        sb.codePointAt(1);
////        if(sb.charAt())
//        sb.charAt()
        System.out.println("sb is empty"+ sb.isEmpty());
//        sb.deleteCharAt(sb.length()-1);
//        new PriorityQueue<Integer>().
        new TreeMap<Integer, Object>().remove(1);

        Map<Integer, Integer> map = new HashMap<>();
        for(Map.Entry entry : map.entrySet()){
            entry.getKey();
            entry.getValue();
        }
        for(Integer fe: map.values()){

            map.size();
        }

        int num = 26;
        num = ~num+1;
        if(random > 1) System.out.println("random");

        char c = '0';
//        char b =  c + (char)1;

//        System.out.println(b);
//        StringBuilder sb = new StringBuilder();
//        sb.deleteCharAt(sb.length()-1);
//        sb.deleteCharAt(sb.length() -1);

        int number = 10;
        //原始数二进制
        printInfo(number);
        number = number << 1;
        //左移一位
        printInfo(number);
        number = number >> 1;
        //右移一位
        printInfo(number);

        number = number >>> 1;

        printInfo(number);
//        int num = -1;
        printInfo(num);
        printInfo(num << 2);

        List<Event> list = new ArrayList<>();
        list.sort((a, b)-> a.pos!=b.pos?a.pos - b.pos : b.type - a.type);


//        TreeMap<Integer, Integer> map = new TreeMap();
//        map.firstKey();
//        map.isEmpty();
        new Stack<Integer>();
        new PriorityQueue<Double>();
        Double a = 1.0;
        Double b = 2.0;
        System.out.println(b - a);
//        Math.abs(?)
        Stack<Integer> stack = new Stack<>();
        stack.isEmpty();

//        Deque<Character> deque = new LinkedList<>();
//        deque.offer('a');
//        deque.offerLast('b');
//        deque.offerFirst('c');
//        while(!deque.isEmpty()){
//            System.out.println(deque.poll());
//            deque.removeLast();
//        }

//        Set<Character>[] set = new Set<Character>[9];
//        set[0].add('a');

        System.out.println((' '-'0')*10);


    }

    /**
     * 输出一个int的二进制数
     * @param num
     */
    private static void printInfo(int num){
        System.out.println(Integer.toBinaryString(num));
    }

    class Event {
        int pos;
        int length;
        int type;//1 产生 0 询问 -1 消失
        public Event(int ty, int po, int len){
            type = ty;
            pos = po;
            length = len;
        }
    }
}
